-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-44713: [Python] Add support for Decimal32 and Decimal64 types #44882
base: main
Are you sure you want to change the base?
Conversation
|
Please add the concrete classes for the scalars to the list under the Scalars heading in And after you add the Thanks! |
Current battles (so I remember them Monday!): I'm missing some member definition for the use-facing type classes: import pyarrow as pa
pa.decimal128(2, 0).precision
#> 2
pa.decimal256(2, 0).precision
#> 2
pa.decimal32(2, 0).precision
#> AttributeError: 'pyarrow.lib.Decimal32Type' object has no attribute 'precision' There's no cast implemented from "float" to "decimal32/64", which at least some of the tests depend on:
|
8ff213e
to
65222c7
Compare
@@ -180,7 +180,8 @@ def print_entry(label, value): | |||
ListViewType, LargeListViewType, | |||
MapType, UnionType, SparseUnionType, DenseUnionType, | |||
TimestampType, Time32Type, Time64Type, DurationType, | |||
FixedSizeBinaryType, Decimal128Type, Decimal256Type, | |||
FixedSizeBinaryType, | |||
Decimal32Type, Decimal64Type, Decimal128Type, Decimal256Type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add Decimal32Array, Decimal64Array
to line 220 and Decimal32Scalar, Decimal64Scalar
to line 229
python/pyarrow/types.pxi
Outdated
Parameters | ||
---------- | ||
precision : int | ||
Must be between 1 and 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should update to between 1 and 18
python/pyarrow/tests/test_compute.py
Outdated
@@ -1900,7 +1900,9 @@ def test_fsl_to_fsl_cast(value_type): | |||
FloatToDecimalCase = namedtuple('FloatToDecimalCase', | |||
('precision', 'scale', 'float_val')) | |||
|
|||
decimal_type_traits = [DecimalTypeTraits('decimal128', pa.decimal128, 38), | |||
decimal_type_traits = [DecimalTypeTraits('decimal32', pa.decimal32, 8), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be 9, not 8?
Rationale for this change
Arrow C++ and the Arrow specification now support 32-bit and 64-bit decimal types...pyarrow should too!
What changes are included in this PR?
Added type, array, and scalar bindings.
Are these changes tested?
Working on it!
Are there any user-facing changes?
Yes! (Working on completing documentation)